<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <style>
        .myheader {
            color: green;
        }
        
        .myfooter {
            color: red;
        }
    </style>
</head>

<body>
    <div id="app">
        <myheader></myheader>
        <myfooter></myfooter>
    </div>

    <template id="temp1">
        <p class="myheader">123</p>
    </template>

    <template id="temp2">
        <p class="myfooter">666</p>
    </template>
</body>
<script>
    var vm = new Vue({
        el: '#app',
        data: {},
        // 注册局部组件
        components: {
            myheader: {
                template: '#temp1'
            },
            myfooter: {
                template: '#temp2'
            }
        }
    })
</script>

</html>